package com.hmall.search.web;

import cn.hutool.json.JSON;
import com.hmall.common.dto.PageDTO;
import com.hmall.common.pojo.RequestParams;
import com.hmall.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @Author mr.ma
 * @Date 2024/11/21 20:26
 */
@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    private SearchService searchService;

    @PostMapping("/filters")
    public JSON filters(@RequestBody RequestParams requestParams){
        return searchService.filter(requestParams);
    }


    @PostMapping("/list")
    public PageDTO list(@RequestBody RequestParams requestParams){
        return searchService.list1(requestParams);
    }

}
